local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        'git',
        'clone',
        '--filter=blob:none',
        'https://github.com/folke/lazy.nvim.git',
        '--branch=stable', -- latest stable release
        lazypath,
    })
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
        ------------------------
        -- Colorscheme, UI
        ------------------------
        {
            {
                'catppuccin/nvim',
                'projekt0n/github-nvim-theme',
                'yourfriendyo/darkplus.nvim',
                'askfiy/visual_studio_code',
                'AlexvZyl/nordic.nvim',
            },
            {
                'RRethy/vim-illuminate', -- word highlight
                config = function()
                    require('user.illuminate')
                end
            },
            {
                'akinsho/bufferline.nvim', -- buffer
                dependencies = {
                    'MunifTanjim/nui.nvim',
                    'nvim-lua/plenary.nvim',
                },
                config = function()
                    require('user.bufferline')
                end,
            },
            {
                'yourfriendyo/lualine.nvim',
                config = function()
                    require('user.lualine')
                end,
            },
            -- {
            --     'nvimdev/indentmini.nvim',
            --     config = function()
            --         require("user.indentmini")
            --     end
            -- },
            {
                'goolord/alpha-nvim',
                config = function()
                    require("user.alpha")
                end
            },
            {
                'rcarriga/nvim-notify',
                config = function()
                    require("user.notify")
                end,
            },
            -- {
            --     'HiPhish/rainbow-delimiters.nvim',
            --     config = function ()
            --         require('user.rainbow-delimiters');
            --     end
            -- }
            {
                "shellRaining/hlchunk.nvim",
                event = { "UIEnter" },
                config = function()
                    require("user.hlchunk")
                end
            },
        },
        ------------------------
        -- Tool
        ------------------------
        {
            'nvim-neo-tree/neo-tree.nvim',
            dependencies = {
                's1n7ax/nvim-window-picker',
                'nvim-lua/plenary.nvim',
                'MunifTanjim/nui.nvim',
            },
            config = function()
                require('user.neo-tree')
            end,
        },
        {
            'folke/which-key.nvim',
            event = 'VeryLazy',
            config = function()
                require('user.whick-key')
            end,
        },
        {
            'lewis6991/gitsigns.nvim',
            config = function()
                require('user.gitsigns')
            end,
        },
        {
            'nvim-telescope/telescope.nvim',
            dependencies = {
                'nvim-telescope/telescope-ui-select.nvim',
                'nvim-telescope/telescope-media-files.nvim',
                {
                    'tom-anders/telescope-vim-bookmarks.nvim',
                    after = 'MattesGroeger/vim-bookmarks',
                },
            },
            config = function()
                require('user.telescope')
            end,
        },
        {
            'hrsh7th/nvim-cmp',
            dependencies = {
                'hrsh7th/cmp-buffer',
                'hrsh7th/cmp-path',
                'hrsh7th/cmp-cmdline',
                'saadparwaiz1/cmp_luasnip',
                'hrsh7th/cmp-nvim-lsp',
                'f3fora/cmp-spell',
                'hrsh7th/cmp-nvim-lsp-signature-help',
                'lukas-reineke/cmp-under-comparator',
                {
                    'tzachar/cmp-tabnine',
                    run = './install.sh',
                }
            },
            config = function()
                require('user.cmp')
            end,
        },
        {
            "windwp/nvim-autopairs",
            event = "InsertEnter",
            config = function()
                require("user.autopairs")
            end
        },
        {
            {
                'L3MON4D3/LuaSnip',
                build = "make install_jsregexp",
            },
            'rafamadriz/friendly-snippets',
        },
        {
            'Pocco81/AutoSave.nvim',
            config = function()
                require('user.autosave')
            end,
            'djoshea/Vim-autoread',
        },
        {
            'williamboman/mason.nvim',
            dependencies = {
                'williamboman/mason-lspconfig.nvim',
                'kosayoda/nvim-lightbulb',
                {
                    'neovim/nvim-lspconfig',
                    config = function()
                        require('user.lsp.lspconfig')
                    end,
                },
                {
                    'ray-x/lsp_signature.nvim',
                    config = function()
                        require('user.lsp.lsp_signature')
                    end,
                },
            },
            config = function()
                require('user.lsp.mason')
            end
        },
        {
            'nvim-treesitter/nvim-treesitter',
            dependencies = {
                'nvim-treesitter/nvim-treesitter-textobjects',
                'romgrk/nvim-treesitter-context',
                'p00f/nvim-ts-rainbow',
            },
            config = function()
                require('user.treesitter')
            end,
        },
        {
            {
                'christoomey/vim-tmux-navigator',
            },
            {
                'aserowy/tmux.nvim',
                config = function()
                    require('user.tmux')
                end,
            },
        },
        {
            "folke/trouble.nvim",
            config = function()
                require("user.trouble")
            end
        },
        {
            'phaazon/hop.nvim',
            branch = 'v2',
            dependencies = {
                'ggandor/leap.nvim',
            },
            config = function()
                require("user.hop")
            end
        },
        {
            'petertriho/nvim-scrollbar',
            config = function()
                require("user.scrollbar")
            end,
        },
        {
            'karb94/neoscroll.nvim',
            config = function()
                require('user.neoscroll')
            end,
        },
        {
            {
                'numToStr/Comment.nvim',
                config = function()
                    require("Comment").setup()
                end,
            },
            {
                'folke/todo-comments.nvim',
                config = function()
                    require("todo-comments").setup()
                end,
            },
        },
        {
            {
                'stevearc/aerial.nvim',
                dependencies = {
                    'nvim-treesitter/nvim-treesitter',
                    'kyazdani42/nvim-web-devicons',
                },
                config = function()
                    require('user.aerial')
                end,
            },
            'ldelossa/litee.nvim',
            'ldelossa/litee-calltree.nvim',
            {
                "simrat39/symbols-outline.nvim",
                config = function()
                    require("user.symbols-outline")
                end
            },
        },
        {
            "norcalli/nvim-colorizer.lua",
            config = function()
                require('colorizer').setup()
            end,
        },
        {
            "utilyre/barbecue.nvim", -- a nice lsp prompt
            dependencies = { "SmiteshP/nvim-navic", },
            config = function()
                require('barbecue').setup()
            end
        },
        {
            "tpope/vim-dadbod", -- a mysql client
            dependencies = {
                {
                    "kristijanhusak/vim-dadbod-ui",
                    cmd = {
                        'DBUI',
                        'DBUIToggle',
                        'DBUIAddConnection',
                        'DBUIFindBuffer',
                    },
                },
                {
                    'kristijanhusak/vim-dadbod-completion',
                    ft = { 'sql', 'mysql', 'plsql' },
                },
            },
            config = function()
                require('user.vim-dadbod')
            end,
        },
        {
            'ethanholz/nvim-lastplace',
            config = function()
                require("user.lastplace")
            end,
        },
        {
            'akinsho/toggleterm.nvim',
            config = function()
                require("user.toggleterm")
            end,
        },
        {
            'mfussenegger/nvim-dap',
            dependencies = {
                'rcarriga/nvim-dap-ui',
                config = function()
                    require('user.dap.dap-ui')
                end,
                'theHamsta/nvim-dap-virtual-text',
            },
            config = function()
                require('user.dap.dap')
            end
        },
    },
    {
        defaults = {
            lazy = false, -- should plugins be lazy-loaded?
        },
        ui = {
            -- a number <1 is a percentage., >1 is a fixed size
            size = { width = 0.8, height = 0.8 },
            wrap = true, -- wrap the lines in the ui
            border = "rounded",
        },
        checker = {
            -- automatically check for plugin updates
            enabled = false,
            concurrency = nil, ---@type number? set to 1 to check for updates very slowly
            notify = true, -- get a notification when new updates are found
            frequency = 3600, -- check for updates every hour
        },
    })
